package cn.cai.utils;

import java.util.Base64;

public class Base64Util {
    /**
     * 编码
     *
     * @param content
     * @return
     */
    public static String encode(byte[] content) {
        Base64.Encoder encoder = java.util.Base64.getEncoder();
        return encoder.encodeToString(content);
    }

    /**
     * 解码
     *
     * @param source
     * @return
     */
    public static byte[] decode(String source) {
        Base64.Decoder decoder = Base64.getDecoder();
        return decoder.decode(source);
    }
}
